package com.yunji.storage.context;

import com.yunji.base.cache.BaseCache;
import com.yunji.common.utils.bean.BeanUtils;
import com.yunji.storage.domain.StockTakeDO;
import com.yunji.storage.vo.StockTakeVO;

import java.util.ArrayList;
import java.util.List;

public class StockTakeConvert {
    public static List<StockTakeVO> domainToVO(List<StockTakeDO> list) {
        List<StockTakeVO> voList = new ArrayList<>();
        list.forEach(item -> voList.add(domainToVO(item)));
        return voList;
    }

    public static StockTakeVO domainToVO(StockTakeDO ticket) {
        StockTakeVO vo = new StockTakeVO();
        BeanUtils.clone(ticket, vo);
        vo.setBelongName(BaseCache.getBelongName(vo.getBelongId()));
        return vo;
    }
}
